//
//  SinaUserAccountModel.m
//  MySinaWeiboProjectForOC
//
//  Created by apple on 2016/11/17.
//  Copyright © 2016年 WangChen. All rights reserved.
//

#import "SinaUserAccountModel.h"

/*
 name;
 avatar_large;
 access_token;
 expires_in;
 uid;
 */

@implementation SinaUserAccountModel

-(void)encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeObject:self.name forKey:@"name"];
    [aCoder encodeObject:self.avatar_large forKey:@"avatar_large"];
    [aCoder encodeObject:self.access_token forKey:@"access_token"];
    [aCoder encodeInteger:self.expires_in forKey:@"expires_in"];
    [aCoder encodeObject:self.uid forKey:@"uid"];
    
}

-(instancetype)initWithCoder:(NSCoder *)aDecoder{
    SinaUserAccountModel *model = [[SinaUserAccountModel alloc]init];
    model.name = [aDecoder decodeObjectForKey:@"name"];
    model.avatar_large = [aDecoder decodeObjectForKey:@"avatar_large"];
    model.access_token = [aDecoder decodeObjectForKey:@"access_token"];
    model.uid = [aDecoder decodeObjectForKey:@"uid"];
    model.expires_in = [aDecoder decodeIntegerForKey:@"expires_in"];
    return model;
}


//重写expire_in的set方法
-(void)setExpires_in:(NSInteger)expires_in{
    _expires_in = expires_in;
    _expires_date = [NSDate dateWithTimeIntervalSinceNow:expires_in];
}




-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

@end
